package com.easepal7506a.project.ui.presenter;


import android.text.TextUtils;
import android.util.Log;

import com.easepal.socketiolib.model.SocketModel;
import com.easepal7506a.project.Constant.CommmandNum;
import com.easepal7506a.project.observer.SocketDataObserver;
import com.easepal7506a.project.observer.TimeObserver;
import com.easepal7506a.project.ui.iview.IAttitudeAdjustmentView7506;


/**
 * Created by FHB on 2018/4/2.
 */

public class AttitudeAdjustmentPressenter7506 implements SocketDataObserver.SocketReceive {
    IAttitudeAdjustmentView7506 mView;



    public AttitudeAdjustmentPressenter7506(IAttitudeAdjustmentView7506 view) {
        mView = view;
        SocketDataObserver.getInst().registerObserver(this);
    }
    public void onDestory(){
        SocketDataObserver.getInst().removeObserver(this);
    }


    @Override
    public void onRceiveSocket(SocketModel model) {
        String key = model.getKey();
        String value = model.getValue();

        if(key.equals(CommmandNum.mStatusZERO)){
            mView.getZero(value);
        }
       else if(key.equals(CommmandNum.mStatusIsResetting)){
            mView.getReset(value);
        }
       else if(key.equals(CommmandNum.mStatusUPDOWNLeg)){
            mView.getUpDownLeg(value);
        }
       else if(key.equals(CommmandNum.mStatusSS)){
            mView.getShenSuo(value);
        }
       else if(key.equals(CommmandNum.mStatusBACKUPDOWN)){
            mView.getBackDown(value);
        }
       else if(key.equals(CommmandNum.mStatusRunning)){
            mView.isPause(value.equals("3"));
            }


    }
}



